package cookie

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func init() {
	r := gin.Default()
	r.GET("cookie", func(context *gin.Context) {
		cookie, err := context.Cookie("key_cookie")
		if err != nil {
			cookie = "NotSet"
			context.SetCookie("key_cookie", "value_cookie", 60, "/",
				"localhost", false, true)
		}
		fmt.Printf("cookie的值是:%s\n", cookie)
	})
	r.Run(":8000")
}
